import 'package:finance_app/src/entities/bank_reconciliation_record_entity.dart';

bankReconciliationRecordEntityFromJson(BankReconciliationRecordEntity data, Map<String, dynamic> json) {
	if (json['data_type'] != null) {
		data.dataType = json['data_type'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['account_id'] != null) {
		data.accountId = json['account_id'] is String
				? int.tryParse(json['account_id'])
				: json['account_id'].toInt();
	}
	if (json['bank_reconciliation_id'] != null) {
		data.bankReconciliationId = json['bank_reconciliation_id'] is String
				? int.tryParse(json['bank_reconciliation_id'])
				: json['bank_reconciliation_id'].toInt();
	}
	if (json['bank_transaction_name'] != null) {
		data.bankTransactionName = json['bank_transaction_name'].toString();
	}
	if (json['bank_transaction_number'] != null) {
		data.bankTransactionNumber = json['bank_transaction_number'].toString();
	}
	if (json['notes'] != null) {
		data.notes = json['notes'];
	}
	if (json['total'] != null) {
		data.total = json['total'] is String
				? num.tryParse(json['total'])
				: json['total'];
	}
	if (json['status'] != null) {
		data.status = json['status'].toString();
	}
	if (json['created_at'] != null) {
		data.createdAt = json['created_at'].toString();
	}
	if (json['updated_at'] != null) {
		data.updatedAt = json['updated_at'].toString();
	}
	if (json['issued_at'] != null) {
		data.issuedAt = json['issued_at'].toString();
	}
	return data;
}

Map<String, dynamic> bankReconciliationRecordEntityToJson(BankReconciliationRecordEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['data_type'] = entity.dataType;
	data['id'] = entity.id;
	data['account_id'] = entity.accountId;
	data['bank_reconciliation_id'] = entity.bankReconciliationId;
	data['bank_transaction_name'] = entity.bankTransactionName;
	data['bank_transaction_number'] = entity.bankTransactionNumber;
	data['notes'] = entity.notes;
	data['total'] = entity.total;
	data['status'] = entity.status;
	data['created_at'] = entity.createdAt;
	data['updated_at'] = entity.updatedAt;
	data['issued_at'] = entity.issuedAt;
	return data;
}